Prices (Token Price Data)
Dune provides reliable token price data for use in your queries across 40+ blockchains. This implementation is a complete rewrite of the price aggregation system with significant improvements.Key Features
- Multi-blockchain support: Prices for tokens across 40+ blockchains
- Standardized native token addresses: Native tokens (like ETH, BNB) have fixed contract addresses for consistency
- Multiple time granularities: hourly, daily, and latest price data
- Source transparency: Each price point includes its data source
- Data quality: Comprehensive filtering to ensure price reliability
- Volume-weighted pricing: Prices are calculated using volume-weighted averages for more accurate representation
- Consistent 5-minute intervals: All data sources aligned to 5-minute intervals for improved consistency
- Enhanced outlier detection: Multi-layered filtering system to reduce impact of anomalous trades
Available Tables
Theprices
schema exposes these main tables:
Table | Description |
---|---|
prices.latest | The most recent price for each token |
prices.day | Daily token prices (volume-weighted average price of each day) |
prices.hour | Hourly token prices (volume-weighted average price of each hour) |
prices.minute | Minute-by-minute token prices |
Implementation Details
The price system works in multiple layers:-
Base data sources:
- External price feeds (Coinpaprika) - provides trusted token prices at 5-minute intervals
- DEX trading data (from
dex.trades
) - aggregated into 5-minute intervals with enhanced outlier detection
-
Data processing pipeline:
- USD price calculation: DEX trades are converted to USD using trusted token prices as reference
- Quality filtering applied to DEX trades to reduce anomalous data impact
- Sparse 5-minute data collected from both sources (aligned intervals for consistency)
- Aggregated to hourly and daily sparse records using volume-weighted averages
- Filled into continuous time series for steady time intervals
-
Token handling:
- Native tokens are assigned fixed addresses instead of NULL or 0xeeee…
- You can find the correct native token address for each blockchain in the
dune.blockchains
table - Trusted tokens (major stablecoins, wrapped assets) serve as price anchors
- Non-trusted tokens derive prices through DEX trades against trusted tokens
- Simply put: We use prices from trusted tokens to calculate USD prices of other tokens based on the data from DEX trades, then apply quality filtering
Coverage
- 900,000 unique tokens
- 40+ blockchains
- new tokens are automatically added when they exceed a $10k volume threshold
Schema
All price tables share the following schema:Column | Type | Description |
---|---|---|
blockchain | varchar | Blockchain identifier (e.g., ‘ethereum’, ‘arbitrum’) |
contract_address | varbinary | Token contract address (fixed address for native tokens) |
symbol | varchar | Token symbol (e.g., ‘ETH’, ‘USDC’) |
price | double | USD price |
timestamp | timestamp | Timestamp (start of minute, hour, or day) |
decimals | int | Token decimals |
volume | double | Trading volume in USD (from price source) |
source | varchar | Data source (‘coinpaprika’ or ‘dex.trades’) |
Technical Notes
- Prices are calculated independently per blockchain
- Token identification requires both
contract_address
ANDblockchain
symbol
is not unique - do not use for token identification or joins- For native tokens, use the standardized addresses from
dune.blockchains
table - If there are no trades for a token, we use the last available price and carry it forward for a limited time period:
- 30 days for daily prices
- 7 days for hourly prices
- 2 days for minute prices
- Quality Filtering: The system includes filtering mechanisms to reduce the impact of anomalous trades, though this is not foolproof
- Volume-Weighted Pricing: Prices are calculated using volume-weighted averages rather than simple medians for more representative pricing
- 5-Minute Intervals: All data sources are aligned to 5-minute intervals for consistency and improved data quality
- Enhanced Protection: Multi-layered outlier detection provides better protection against price manipulation and flash crashes
Methodology
Step 1: Importing Trusted Token Prices
Dune sources trusted token prices from Coin Paprika. These prices:- Cover major tokens that are defined in the
prices.trusted_tokens
table - Serve as base prices for calculating prices of other tokens traded against them in DEX pairs
- Are updated at 5-minute intervals
Step 2: DEX-Derived Prices with Quality Filtering
For details on how Dune processes DEX trade data to derive accurate token prices, see the DEX Trade Processing:- We start by collecting raw trading data from the
dex.trades
table - We calculate USD prices for trading pairs where one token is from our trusted token list using trusted token prices as reference
- Quality filtering is then applied to reduce the impact of anomalous trades:
- VWMP Outlier Detection: Prices that deviate more than 3x from the rolling 7-day volume-weighted median price
- MAD Outlier Detection: Prices that deviate more than 2x the median absolute deviation from the hourly VWMP
- Transfer Outlier Detection: Token amounts that exceed the maximum transfer amount seen in the past 7 days
- Volume Outlier Detection: Trade volumes below 1,000,000
- The filtered data then goes through our processing pipeline which:
- Excludes trades with less than $10,000 USD in total volume
- Aggregates trades into 5-minute intervals using volume-weighted averages
- Takes the volume-weighted average price from each interval to reduce outlier impact
- Uses forward-filling to handle periods without valid trades, with time limits
- 30 days for daily prices
- 7 days for hourly prices
- 2 days for minute prices
Quality Filtering Rules
The quality filtering system uses multiple statistical methods to identify and flag potentially anomalous trades:-
VWMP Outlier Detection:
- Trades where the relative price deviation from the 7d rolling median price is greater than a factor 3 (in both directions)
-
MAD Outlier Detection:
- Trades where the absolute price deviation from the 4h rollingmedian price is greater than 2 times the 4h rolling median absolute deviation
-
Transfer Outlier Detection:
- Trades where the token amount is greater than the maximum transfer amount
- This helps identify trades that report larger amounts than the actual transfers
-
Volume Outlier Detection:
- Trades with volumes below 1,000,000
- This helps filter out dust trades and suspiciously large volumes
Usage Examples
Here are some examples of how to use the prices tables.Basic query to get the latest ETH price:
Getting historical price data:
Finding the right native token address:
Legacy Tables
The following tables are maintained for historical compatibility but we no longer add tokens to them:prices.usd
prices.usd_daily
prices.usd_latest